import { downloadFile, getAction, postAction } from '@/api/manage'

const listOrgsWithRatio = (param) => getAction('/biz/api/cscm/getCompanyTree', param)
const getOrgCostInfo = (param) => getAction('/biz/api/cscm/getCompanyCostInfo', param)

const setCostRateConfig = (param) => postAction('/biz/api/cscmconfig/cosconfig/set', param)
const addNonPolicyFee = (param) => postAction('/biz/api/cscmconfig//nonpolicy/add', param)

const getServiceConfigList = (param) => getAction('/biz/api/cscmconfig/service/list', param)
const setServiceFeeConfig = (param) => postAction('/biz/api/cscmconfig/service/set', param)

const getPayeeList = (param) => getAction('/biz/api/cscmconfig/paymenttarget/list', param)
const addPayee = (param) => postAction('/biz/api/cscmconfig/paymenttarget/add', param)
const editPayee = (param) => postAction('/biz/api/cscmconfig/paymenttarget/update', param)
const delPayee = (param) => getAction('/biz/api/cscmconfig/paymenttarget/delete', param)

const getApplyList = (param) => getAction('/biz/api/cscm/getCostApplyListPage', param)
const getApplyDetail = (param) => getAction('/biz/api/cscm/getCostApplyDetail', param)

const getPolicyList = (param) => getAction('/biz/api/cscm/getPolicyListPage', param)
const getCostPolicyCalResult = (param) => postAction('/biz/api/cscm/getCostPolicyCalResult', param)

const createApply = (param) => postAction('/biz/api/cscm/createCostApply', param)
const approveApply = (param) => getAction('/biz/api/cscm/approveCostApply', param)
const addItem = (param) => postAction('/biz/api/cscm/addInvoice', param)
const delItem = (param) => postAction('/biz/api/cscm/deleteInvoice', param)

const exportBatchList = (param) => downloadFile('/biz/api/cscm/exportBatchList', param)
const exportPolicyList = (param) => downloadFile('/biz/api/cscm/exportPolicyList', param)

const getInvoiceKemuList = (param) => getAction('/biz/api/cscmconfig/invoice/kemu',param)

export default {
  listOrgsWithRatio,
  getOrgCostInfo,
  setCostRateConfig,
  addNonPolicyFee,
  getServiceConfigList,
  setServiceFeeConfig,
  getPayeeList,
  addPayee,
  editPayee,
  delPayee,
  getApplyList,
  getApplyDetail,
  getPolicyList,
  getCostPolicyCalResult,
  createApply,
  approveApply,
  addItem,
  delItem,
  exportBatchList,
  exportPolicyList,
  getInvoiceKemuList
}
